﻿using EntityModel;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace API.Controllers
{
    /// <summary>
    /// 职工信息控制器
    /// </summary>
    [Route("api/[controller]")]
    [ApiController]
    public class EmployeeController : ControllerBase
    {
        private readonly APIDbContext db;

        public EmployeeController(APIDbContext context)
        {
            db = context;
        }

        [HttpGet]
        public List<Employee> GetAllemployee()
        {
            return db.employee.ToList();
        }

        [HttpGet("{Postion}")]
        public List<Employee> Get(int Postion)
        {

            Employee?  employee= db.employee.Where(w => w.Postion == 1).FirstOrDefault<Employee>();
            return db.employee.ToList();
        }
    }
}
